
/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: Gao zhao xu
 * Date: 2023-06-13
 * Time: 9:19
 */
class Login{
    public String useName = "gcx";
    public String passWord = "cg050213";
    public void LoginInfo(String useName, String passWord) {
        if (!this.useName.equals(useName)){
            throw new UseNameException("用户名错误");
        }
        if (!this.passWord.equals(passWord)){
            throw new PassWordException("密码错误");
        }
        System.out.println("登录成功！");
    }
}
public class test1 {
    public static void main(String[] args) {
        Login login = new Login();
        try{
            login.LoginInfo("gcx", "cg05021");
        }catch (UseNameException | PassWordException e){
            e.printStackTrace();
        }
    }
}
